# Extraido de minescape.py - siPYgames
import pygame,  Utilities
from pygame.locals import *
from Utilities import *

class Button(pygame.sprite.Sprite):
    def __init__(self,  imageName1,  imageName2, x, y,  text,  width,  height):
        pygame.sprite.Sprite.__init__(self)
        self.width=300
        self.height=50
        self.x=x
        self.y=y
        self.width = width
        self.height = height
        self.color=color
        self.imageName1 = imageName1
        self.imageName2 = imageName2
        self.image = load_image(imageName1,  -1)
        self.image = pygame.transform.scale(self.image,  (self.width, self.height))
        self.rect=self.image.get_rect()
        self.rect.center = (x, y)
        self.text = text
        self.selected = 0
        
    def updateImage(self):
        if self.selected:
            self.image = load_image(self.imageName1,  -1)
            self.selected = 0
        else:
            self.image = load_image(self.imageName2,  -1)
            self.selected = 1
        self.image = pygame.transform.scale(self.image,  (self.width, self.height))
        self.rect=self.image.get_rect()
        self.rect.center = (self.x, self.y)
